package com.tianji.api.client.promotion;

import com.tianji.api.client.promotion.fallback.PromotionFallback;
import com.tianji.api.dto.promotion.CouponDiscountDTO;

import com.tianji.api.dto.promotion.OrderCouponDTO;
import com.tianji.api.dto.promotion.OrderCourseDTO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Yandel
 * @date 2025/8/20 下午12:47
 * @description: 促销服务 feign 接口
 */
@FeignClient(name = "promotion-service", fallbackFactory = PromotionFallback.class)
public interface PromotionClient {

    /**
     * 该方法是给tj-trade服务，远程调用使用
     *
     * @param
     * @return
     */
    @PostMapping("user-coupons/available")
    public List<CouponDiscountDTO> findDiscountSolution(@RequestBody List<OrderCourseDTO> orderCourses);

    /**
     * 根据券方案计算订单优惠明细
     *
     * @param orderCouponDTO
     * @return
     */
    @ApiOperation("根据券方案计算订单优惠明细")
    @PostMapping("/user-coupons/discount")
    public CouponDiscountDTO queryDiscountDetailByOrder(@RequestBody OrderCouponDTO orderCouponDTO);

    /**
     * 分页查询我的优惠券接口
     *
     * @param userCouponIds
     * @return
     */
    @ApiOperation("分页查询我的优惠券接口")
    @GetMapping("/user-coupons/rules")
    public List<String> queryDiscountRules(
            @ApiParam("用户优惠券id集合") @RequestParam("couponIds") List<Long> userCouponIds);
}
